package com.lsc.base.controller;

import java.util.ArrayList;
import java.util.List;

import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import com.lsc.base.dto.User;
import com.smf.lsc.core.respones.Result;
import com.smf.lsc.core.respones.ResultUtil;
import com.smf.lsc.security.converter.MyUserDetails;

import lombok.extern.slf4j.Slf4j;

@RestController
@Slf4j
@Validated
@RequestMapping("/base")
public class BaseController {
	
	@GetMapping("/getCurrentUser")
	public Result<MyUserDetails> getCurrentUser()
	{
		MyUserDetails user=new MyUserDetails();
    	user.setAccount("admin");
    	user.setUserName("lsc管理员");
    	user.setUnitId("456");
    	user.setUnitName("测试机构");
		return ResultUtil.successResult(user,"");
	}
	
	@GetMapping("/getAllUser")
	public Result<MyUserDetails> getAllUser(int pageSize,int pageNum)
	{
		List<User> li=new ArrayList();
		for(int i=pageNum*pageSize;i<(pageNum+1)*pageSize;i++)
		{
			User user=new User();
			user.setUserName(i+"");
			user.setUserNickname(i+"测试");
			li.add(user);
		}
		return ResultUtil.successResult(li,"");
	}
}
